{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "cb9e3f4a",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "[[-2.76600458e-02  1.35820791e-01  1.32595226e-02 -1.05363742e-01\n",
      "   1.68416705e-02 -3.35913375e-02  1.75771579e-01 -7.60889277e-02\n",
      "  -1.17009580e-01 -1.87916324e-01  1.02984764e-01  8.43518302e-02\n",
      "  -5.71658078e-04  1.74038112e-01 -3.05847526e-02  3.38763706e-02\n",
      "  -6.64571896e-02  1.20746931e-02 -5.33462763e-02 -6.64668009e-02\n",
      "   2.47811303e-02 -1.31367072e-01  2.32601296e-02 -5.98320253e-02\n",
      "  -5.52567206e-02 -3.83350290e-02  5.18865772e-02 -7.22144172e-02\n",
      "   1.22762695e-01  6.51968792e-02 -8.09349045e-02 -3.06510329e-01\n",
      "  -7.07045794e-02 -2.97895409e-02 -1.55128881e-01  4.36793305e-02\n",
      "  -1.41397715e-01 -9.66324508e-02  7.26912320e-02 -7.44867325e-03\n",
      "  -2.08447456e-01 -1.64717287e-02 -1.71841338e-01 -2.22214889e-02\n",
      "   4.04146351e-02 -7.75995627e-02 -3.04063391e-02  7.06241140e-03\n",
      "  -1.10398069e-01 -1.89637184e-01  2.17691921e-02 -6.81958273e-02\n",
      "  -6.80538416e-02 -1.23538252e-03  3.55712958e-02 -8.27289671e-02\n",
      "   5.97497486e-02 -2.11889178e-01  1.37995025e-02  2.12828442e-01\n",
      "  -1.21791445e-01 -2.58833617e-02  1.66420918e-02  1.17115282e-01\n",
      "   2.10910827e-01 -2.03829054e-02 -5.44295497e-02  1.78194776e-01\n",
      "   1.54148787e-01 -2.83884909e-02 -5.47953136e-02 -6.15730472e-02\n",
      "   9.84489769e-02 -6.58034161e-02  2.08199501e-01  2.87342761e-02\n",
      "   7.13993385e-02  2.01979235e-01 -1.18500106e-01  1.08639076e-01\n",
      "   1.22518018e-01  7.99310729e-02 -3.24041359e-02 -7.18602166e-02\n",
      "  -8.62452015e-02 -1.40205398e-01 -8.67105350e-02  4.27876152e-02\n",
      "   1.44972548e-01 -5.68540059e-02  5.59594147e-02  2.05466136e-01\n",
      "   1.43348679e-01 -7.62429163e-02 -3.80624570e-02  1.65098697e-01\n",
      "   2.64108032e-02  2.15430364e-01 -2.73348242e-02 -3.29435952e-02]\n",
      " [ 4.33383398e-02  1.67226121e-01  4.80708890e-02  8.07649717e-02\n",
      "  -7.06406310e-02 -2.45736718e-01  1.40268937e-01  1.88843831e-01\n",
      "   5.31275757e-02 -1.28740117e-01  1.29453227e-01 -8.05968270e-02\n",
      "  -1.06062494e-01 -3.84440944e-02  8.61222576e-03 -4.21606526e-02\n",
      "  -1.50215551e-01 -7.66317993e-02  1.04598120e-01 -7.96814114e-02\n",
      "   1.23741604e-01  2.56474447e-02  1.30061507e-02  8.80885497e-02\n",
      "   7.79787377e-02  4.22222679e-03 -1.68180224e-02 -7.70839676e-02\n",
      "  -1.26638263e-02  4.77167256e-02 -2.17903882e-01 -1.03720678e-02\n",
      "  -9.39899608e-02  7.62870759e-02 -1.40769824e-01 -1.65292576e-01\n",
      "   1.24268129e-01  2.15973571e-01 -2.01173257e-02 -1.67839393e-01\n",
      "   7.59750828e-02  6.92040697e-02  1.38086855e-01  1.18353367e-01\n",
      "   3.39459926e-02  4.18010615e-02  2.83064723e-01  5.72117269e-02\n",
      "  -1.58530250e-01  1.37024149e-01 -1.22401573e-01 -6.36589229e-02\n",
      "   3.27401124e-02 -9.65118129e-03 -8.32945108e-02 -2.80239787e-02\n",
      "   7.28464648e-02 -3.28035392e-02  2.11614951e-01  1.39498457e-01\n",
      "   5.73063865e-02  1.75336123e-01 -6.01305924e-02 -5.65823726e-02\n",
      "  -4.92984839e-02  3.30670625e-02  1.16737224e-02 -1.21859917e-02\n",
      "   8.32718983e-02  2.31360495e-02  1.63563475e-01  3.66201922e-02\n",
      "  -1.65959463e-01  1.31159469e-01  8.95131677e-02 -8.17963779e-02\n",
      "   4.84934151e-02 -4.50327806e-02  5.11389375e-02 -6.31600544e-02\n",
      "  -1.82569511e-02 -3.27593684e-02  1.90188847e-02 -3.18435170e-02\n",
      "   4.61080857e-02 -4.31539081e-02 -4.59469892e-02 -2.45429203e-03\n",
      "  -2.29220584e-01 -5.95437316e-03  5.99502213e-02 -1.04557417e-01\n",
      "   2.25166976e-02  1.08150475e-01  1.89384967e-01 -9.17929932e-02\n",
      "   4.83914427e-02  7.59816840e-02  5.09285443e-02  1.08559124e-01]\n",
      " [-7.76907355e-02  8.43887404e-02  1.50025651e-01 -4.55830358e-02\n",
      "   6.84652254e-02 -1.14893816e-01  2.18580943e-02  2.06909869e-02\n",
      "   1.15575068e-01  2.66779363e-02 -8.15560222e-02  1.07499413e-01\n",
      "   6.67147562e-02 -5.69455437e-02  6.86349869e-02 -3.81880924e-02\n",
      "   3.47526781e-02 -3.36520560e-02 -1.81579813e-02 -2.13785712e-02\n",
      "   3.58357057e-02 -1.73117474e-01 -1.68837175e-01  2.38396581e-02\n",
      "   1.56377077e-01 -2.27785297e-02 -2.44649485e-01 -1.58424780e-01\n",
      "   8.88338014e-02 -9.15718600e-02 -1.79640595e-02  7.75508583e-03\n",
      "  -1.17535308e-01 -3.72060277e-02 -7.67879188e-03  3.77694555e-02\n",
      "   2.29441124e-04 -6.58894330e-02  2.12098315e-01 -3.27157900e-02\n",
      "  -2.17344221e-02 -2.76657436e-02  1.90606728e-01  1.51882753e-01\n",
      "   8.57784748e-02 -2.43076496e-02 -9.76706371e-02 -9.79551449e-02\n",
      "   2.35423241e-02  8.97856355e-02  2.19020247e-01 -5.68040013e-02\n",
      "  -6.45918623e-02 -1.17340423e-02 -1.53269455e-01  2.03548297e-01\n",
      "   1.08514033e-01  1.88184813e-01  3.77216153e-02 -2.22489715e-01\n",
      "   5.92167266e-02  1.20214401e-02 -4.57825214e-02  1.71148226e-01\n",
      "   4.27251831e-02 -5.04716709e-02  1.07802572e-02 -7.65880868e-02\n",
      "   8.11058879e-02  6.69453070e-02  1.62782315e-02  4.18492109e-02\n",
      "   1.12330485e-02 -7.03731030e-02  1.92160252e-03  6.06342927e-02\n",
      "   1.63202062e-01  1.70285478e-01  2.54440513e-02  9.36898813e-02\n",
      "   7.24542737e-02 -3.60523462e-02 -1.07276715e-01 -1.23526491e-01\n",
      "   1.39170274e-01  2.04122886e-01  3.57414447e-02  2.98042279e-02\n",
      "   1.79915085e-01  1.02863861e-02 -1.27807304e-01  5.29613681e-02\n",
      "  -2.23341092e-01 -8.38351697e-02  8.78640339e-02 -1.10954225e-01\n",
      "  -8.98615047e-02 -2.04608798e-01  1.14111461e-01 -4.03446369e-02]\n",
      " [ 3.62962671e-02  1.05813704e-02  5.79676032e-02  6.79018646e-02\n",
      "  -2.19963074e-01 -6.00655042e-02 -2.04286084e-01  6.94895685e-02\n",
      "   7.30639771e-02 -8.11569765e-02 -1.40885785e-01  3.86254154e-02\n",
      "  -1.74260512e-02  9.66704041e-02  3.89889441e-02 -4.27316166e-02\n",
      "   1.17470026e-01  1.03043893e-03  2.96831764e-02  1.43853918e-01\n",
      "   5.74843064e-02 -6.83948919e-02  2.94788834e-02  2.30601002e-02\n",
      "   1.39682218e-01  5.35468124e-02 -4.59441654e-02  2.55337656e-02\n",
      "  -4.49863337e-02 -3.95007022e-02 -1.28263637e-01 -8.46110582e-02\n",
      "  -1.15862682e-01 -1.28481343e-01  7.89874867e-02  5.47650531e-02\n",
      "   1.13644361e-01 -1.35146724e-02  4.96378615e-02 -1.13675259e-01\n",
      "   4.24832515e-02  1.05878308e-01  3.56782041e-02 -7.51129314e-02\n",
      "  -1.45920470e-01  4.38965149e-02 -2.31372476e-01  7.09635485e-03\n",
      "   1.07661940e-01 -6.73900172e-02 -1.00171916e-01  4.44792882e-02\n",
      "  -6.76943827e-03  3.50011326e-02 -1.32775409e-02  9.90103334e-02\n",
      "  -1.10792100e-01  8.00079480e-03 -7.49324188e-02  1.33750616e-02\n",
      "   3.60462070e-02 -4.07795124e-02  4.09781486e-02 -5.08358479e-02\n",
      "   2.06274897e-01  7.95230120e-02  7.28510395e-02 -2.22024117e-02\n",
      "  -8.61484706e-02 -1.30564319e-02 -2.26372167e-01 -4.03693952e-02\n",
      "   8.45853984e-02 -1.78061783e-01 -1.88443467e-01  9.33029205e-02\n",
      "   2.43167639e-01 -6.88778982e-02 -2.80534532e-02  6.87890872e-02\n",
      "  -2.01442521e-02 -4.95662317e-02 -1.36527985e-01  1.31385997e-01\n",
      "   2.04792306e-01 -5.28242365e-02  6.13359036e-03  1.41282007e-01\n",
      "  -1.48546323e-01 -3.19960974e-02  2.99601972e-01 -2.44421586e-02\n",
      "  -1.12344828e-02  4.91445921e-02 -9.36290342e-03  4.65645157e-02\n",
      "   1.10225916e-01 -7.53006563e-02  3.02960780e-02 -8.31570327e-02]]\n",
      "<NDArray 4x100 @cpu(0)>\n",
      "epoch 1,loss 534512.562500\n",
      "epoch 2,loss 426804.156250\n",
      "epoch 3,loss 431914.062500\n",
      "epoch 4,loss 435843.062500\n",
      "epoch 5,loss 793310.562500\n",
      "epoch 6,loss 368725.843750\n",
      "epoch 7,loss 285260.187500\n",
      "epoch 8,loss 316185.687500\n",
      "epoch 9,loss 172041.875000\n",
      "epoch 10,loss 540070.187500\n",
      "epoch 11,loss 209979.046875\n",
      "epoch 12,loss 321363.312500\n",
      "epoch 13,loss 132434.062500\n",
      "epoch 14,loss 57019.984375\n",
      "epoch 15,loss 88706.726562\n",
      "epoch 16,loss 175676.687500\n",
      "epoch 17,loss 49142.273438\n",
      "epoch 18,loss 51929.511719\n",
      "epoch 19,loss 57766.375000\n",
      "epoch 20,loss 83376.156250\n",
      "epoch 21,loss 66449.710938\n",
      "epoch 22,loss 144612.609375\n",
      "epoch 23,loss 421065.750000\n",
      "epoch 24,loss 74972.328125\n",
      "epoch 25,loss 53931.851562\n",
      "epoch 26,loss 48062.761719\n",
      "epoch 27,loss 262767.468750\n",
      "epoch 28,loss 93137.843750\n",
      "epoch 29,loss 96917.867188\n",
      "epoch 30,loss 157178.171875\n",
      "epoch 31,loss 78854.765625\n",
      "epoch 32,loss 115516.750000\n",
      "epoch 33,loss 150604.437500\n",
      "epoch 34,loss 42339.417969\n",
      "epoch 35,loss 840643.812500\n",
      "epoch 36,loss 84787.218750\n",
      "epoch 37,loss 51763.578125\n",
      "epoch 38,loss 64004.480469\n",
      "epoch 39,loss 96516.273438\n",
      "epoch 40,loss 40607.476562\n",
      "epoch 41,loss 38528.078125\n",
      "epoch 42,loss 36247.722656\n",
      "epoch 43,loss 42575.054688\n",
      "epoch 44,loss 38624.722656\n",
      "epoch 45,loss 36013.082031\n",
      "epoch 46,loss 48575.109375\n",
      "epoch 47,loss 45160.222656\n",
      "epoch 48,loss 45539.070312\n",
      "epoch 49,loss 35008.769531\n",
      "epoch 50,loss 36708.882812\n"
     ]
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import d2lzh as d2l\n",
    "import xlrd\n",
    "import random\n",
    "import math\n",
    "from IPython import display\n",
    "from matplotlib import pyplot as plt\n",
    "from mxnet import autograd, nd\n",
    "batch_size = 1\n",
    "num_inputs = 4\n",
    "num_outputs = 1\n",
    "num_hiddens=100\n",
    "\n",
    "\n",
    "w = nd.random.normal(scale=0.1, shape=(num_inputs, num_hiddens))\n",
    "b = nd.zeros(num_hiddens)\n",
    "w1=nd.random.normal(scale=0.1, shape=(num_hiddens, num_outputs))\n",
    "b1= nd.zeros(num_outputs)\n",
    "\n",
    "w.attach_grad()\n",
    "b.attach_grad()\n",
    "w1.attach_grad()\n",
    "b1.attach_grad()\n",
    "\n",
    "\n",
    "params=[w,b,w1,b1]\n",
    "print(w)\n",
    "def use_svg_display():\n",
    "    # 用矢量图显示\n",
    "    display.set_matplotlib_formats('svg')\n",
    "\n",
    "def set_figsize(figsize=(3.5, 2.5)):\n",
    "    use_svg_display()\n",
    "    # 设置图的尺寸\n",
    "    plt.rcParams['figure.figsize'] = figsize\n",
    "\n",
    "def squared_loss(y_hat, y):\n",
    "    return (y_hat - y) ** 2 / 2\n",
    "\n",
    "def relu(X):\n",
    "    return nd.maximum(X,0)\n",
    "\n",
    "def net(X):\n",
    "    H=relu(nd.dot(X,w)+b)\n",
    "    Y=nd.dot(H, w1) + b1\n",
    "    return Y\n",
    "\n",
    "def excel2matrix(path):\n",
    "    data = xlrd.open_workbook(path)\n",
    "    table = data.sheets()[0]\n",
    "    nrows = table.nrows  # 行数\n",
    "    ncols = table.ncols  # 列数\n",
    "    datamatrix = nd.random.normal(scale=1,shape=(nrows, ncols))\n",
    "    for i in range(nrows):\n",
    "        rows = table.row_values(i)\n",
    "        datamatrix[i,:] = rows\n",
    "    return datamatrix\n",
    " \n",
    "def data_iter(batch_size, features, labels):\n",
    "    num_examples = len(features)\n",
    "    indices = list(range(num_examples))\n",
    "    random.shuffle(indices)  # 样本的读取顺序是随机的\n",
    "    for i in range(0, num_examples, batch_size):\n",
    "        j = nd.array(indices[i: min(i + batch_size, num_examples)])\n",
    "        yield features.take(j), labels.take(j)  # take函数根据索引返回对应元素\n",
    "# def cross_entropy(y_hat, y):\n",
    "#     return -nd.pick(y_hat, y).log()\n",
    "# def accuracy(y_hat, y):\n",
    "#     return (y_hat.argmax(axis=1) == y.astype('float32')).mean().asscalar()\n",
    "\n",
    "# def evaluate_accuracy(data_iter, net):\n",
    "#     acc_sum, n = 0.0, 0\n",
    "#     for X, y in data_iter:\n",
    "#         y = y.astype('float32')\n",
    "#         acc_sum += (net(X).argmax(axis=1) == y).sum().asscalar()\n",
    "#         n += y.size\n",
    "#     return acc_sum / n\n",
    "\n",
    "num_epochs, lr = 50, 0.00001\n",
    "\n",
    "def sgd(params, lr, batch_size):  \n",
    "    for param in params:\n",
    "        param[:] = param - lr * param.grad / batch_size\n",
    "\n",
    "def train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,\n",
    "              params=None, lr=None):\n",
    "    for epoch in range(num_epochs):\n",
    "        for X, y in data_iter(batch_size,x,x_label):\n",
    "            with autograd.record():\n",
    "                y_hat = net(X)\n",
    "#                 print('X')\n",
    "#                 print(X)\n",
    "#                 print('y_hat')\n",
    "#                 print(y_hat)\n",
    "#                 print('y')\n",
    "#                 print(y)\n",
    "#                 print('[W,b]')\n",
    "#                 print([w,b])\n",
    "                l = loss(y_hat, y)\n",
    "            l.backward()   #求梯度\n",
    "            sgd(params, lr, batch_size)    #更新wb权重   \n",
    "#         print(params)\n",
    "        train_l_sum =loss(net(x),x_label)  #误差\n",
    "        print('epoch %d,loss %f' % (epoch + 1,train_l_sum.mean().asnumpy()))\n",
    "\n",
    "\n",
    "pathX = '309.xls'  #  113.xlsx 在当前文件夹下\n",
    "pathX2 = '309_label.xls'  #  113.xlsx 在当前文件夹下\n",
    "pathX3 = '309_pre.xls'  #  113.xlsx 在当前文件夹下\n",
    "x = excel2matrix(pathX)\n",
    "x_label=excel2matrix(pathX2)\n",
    "y_test=excel2matrix(pathX3)\n",
    "y_label=nd.zeros((y_test.shape[0],1))\n",
    "\n",
    "train_iter=data_iter(batch_size,x,x_label)\n",
    "test_iter=data_iter(batch_size,y_test,y_label)\n",
    "train_ch3(net, train_iter, test_iter, squared_loss, num_epochs, batch_size,params, lr)\n",
    "#set_figsize()\n",
    "#plt.scatter(x[:, 1].asnumpy(), x_label[:, 0].asnumpy(), 1);  # 加分号只显示图\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "e86025e9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[\n",
      "[[-2.76600458e-02  3.17626739e+00  3.10763836e-01 -1.05363742e-01\n",
      "   2.24477649e+00 -3.35913375e-02  2.37760097e-01 -9.93457031e+00\n",
      "   4.96644229e-02 -1.87916324e-01  3.70667877e+01  8.88976678e-02\n",
      "   3.04407477e-01  1.57550287e+00  3.78817990e-02  3.38763706e-02\n",
      "  -1.33908253e+01  1.20746931e-02 -5.33462763e-02 -6.64668009e-02\n",
      "   1.41694713e+00 -1.31367072e-01  2.32601296e-02 -5.98320253e-02\n",
      "   4.28496823e-02 -3.83350290e-02  5.18865772e-02 -7.22144172e-02\n",
      "   8.76964188e+00  6.51968792e-02 -8.09349045e-02 -3.06510329e-01\n",
      "  -7.07045794e-02 -2.97895409e-02 -1.55128881e-01  1.10352272e-02\n",
      "  -1.41397715e-01 -9.66324508e-02  1.92591056e-01 -7.44867325e-03\n",
      "  -2.08447456e-01 -2.03787088e-02 -1.87472649e+01  1.40155184e+00\n",
      "   2.92235637e+00 -7.75995627e-02 -3.04063391e-02  7.06241140e-03\n",
      "  -1.35184841e+01 -1.89637184e-01  4.32574004e-02 -6.81958273e-02\n",
      "  -6.80538416e-02 -2.73341870e+00  3.55712958e-02 -2.02742043e+01\n",
      "   1.87359066e+01 -2.04439602e+01 -2.37874836e-02  2.12828442e-01\n",
      "  -1.23891167e-01 -2.58833617e-02  1.66420918e-02  3.32993746e+00\n",
      "   1.74434638e+00 -2.03829054e-02 -8.12807751e+00  1.32244393e-01\n",
      "   3.67295313e+00 -5.74990660e-02 -5.47953136e-02 -6.15730472e-02\n",
      "   1.57165766e-01 -6.58034161e-02  1.78044300e+01  1.93424672e-01\n",
      "   3.21954787e-01  2.54821658e+00 -1.18500106e-01  4.10070866e-01\n",
      "   2.01301599e+00  1.58500643e+01 -3.24041359e-02 -7.18602166e-02\n",
      "   2.08648011e-01  7.40446091e-01 -8.67105350e-02  2.51786232e-01\n",
      "   4.60078150e-01 -5.68540059e-02  4.42041196e-02  2.01972342e+00\n",
      "   1.43348679e-01 -7.62429163e-02 -7.42357746e-02  1.38222501e-01\n",
      "   2.64108032e-02  2.06945017e-01 -8.86332244e-02 -3.29435952e-02]\n",
      " [ 4.33383398e-02  3.19080677e+01  1.00119772e+01  8.07649717e-02\n",
      "  -1.06086445e+01 -2.45736718e-01 -4.34908330e-01 -6.56525326e+00\n",
      "   4.65887547e+00 -1.28740117e-01  1.50147537e+02  2.82961154e+00\n",
      "   9.49370766e+00  1.46998405e+01  2.44955969e+00 -4.21606526e-02\n",
      "  -1.12991753e+01 -7.66317993e-02  1.04598120e-01 -7.96814114e-02\n",
      "   1.16140842e+01  2.56474447e-02  1.30061507e-02  8.80885497e-02\n",
      "   3.88774180e+00  4.22222679e-03 -1.68180224e-02 -7.70839676e-02\n",
      "   4.32530975e+01  4.77167256e-02 -2.17903882e-01 -1.03720678e-02\n",
      "  -9.39899608e-02  7.62870759e-02 -1.40769824e-01 -2.99770474e-01\n",
      "   1.24268129e-01  2.15973571e-01  7.12667179e+00 -1.67839393e-01\n",
      "   7.59750828e-02  6.91604167e-02 -1.61039734e+01  8.66848183e+00\n",
      "   2.35306759e+01  4.18010615e-02  2.83064723e-01  5.72117269e-02\n",
      "  -6.08605528e+00  1.37024149e-01  4.50308704e+00 -6.36589229e-02\n",
      "   3.27401124e-02 -2.22301769e+00 -8.32945108e-02 -1.41310434e+01\n",
      "   9.26702042e+01 -1.69744091e+01  2.09194601e-01  1.39498457e-01\n",
      "   5.72823621e-02  1.75336123e-01 -6.01305924e-02  2.68270817e+01\n",
      "   1.30221357e+01  3.30670625e-02 -6.53960943e+00 -1.50790578e-02\n",
      "   2.98939381e+01  1.86234862e-02  1.63563475e-01  3.66201922e-02\n",
      "   3.32009649e+00  1.31159469e-01  8.60551453e+01  5.84487295e+00\n",
      "   9.41529179e+00  2.01729317e+01  5.11389375e-02  1.07290745e+01\n",
      "   1.58144207e+01  9.08681107e+01  1.90188847e-02 -3.18435170e-02\n",
      "   8.73044109e+00  8.58884048e+00 -4.59469892e-02  6.38094425e+00\n",
      "   1.34438591e+01 -5.95437316e-03  5.98189421e-02  1.54498644e+01\n",
      "   2.25166976e-02  1.08150475e-01  1.87098756e-01 -9.35237110e-02\n",
      "   4.83914427e-02  7.58592933e-02  4.70156893e-02  1.08559124e-01]\n",
      " [-7.76907355e-02 -1.02969294e+01 -3.34855437e+00 -4.55830358e-02\n",
      "  -1.84107411e+00 -1.14893816e-01 -1.97248101e-01  5.88825130e+00\n",
      "  -1.47825146e+00  2.66779363e-02 -4.12769279e+01 -9.72089827e-01\n",
      "  -3.20820332e+00 -4.87992048e+00 -7.91714907e-01 -3.81880924e-02\n",
      "   1.08049908e+01 -3.36520560e-02 -1.81579813e-02 -2.13785712e-02\n",
      "  -3.78501368e+00 -1.73117474e-01 -1.68837175e-01  2.38396581e-02\n",
      "  -1.23864233e+00 -2.27785297e-02 -2.44649485e-01 -1.58424780e-01\n",
      "  -1.43856134e+01 -9.15718600e-02 -1.79640595e-02  7.75508583e-03\n",
      "  -1.17535308e-01 -3.72060277e-02 -7.67879188e-03 -7.97767192e-03\n",
      "   2.29441124e-04 -6.58894330e-02 -2.37346148e+00 -3.27157900e-02\n",
      "  -2.17344221e-02 -3.40801403e-02  1.52084274e+01 -2.64092875e+00\n",
      "  -7.68368387e+00 -2.43076496e-02 -9.76706371e-02 -9.79551449e-02\n",
      "   3.23797226e+00  8.97856355e-02 -1.43016016e+00 -5.68040013e-02\n",
      "  -6.45918623e-02  2.18763709e+00 -1.53269455e-01  1.29784803e+01\n",
      "  -3.07575264e+01  1.65024643e+01 -4.61724028e-03 -2.22489715e-01\n",
      "   5.56866005e-02  1.20214401e-02 -4.57825214e-02 -8.79637146e+00\n",
      "  -4.41858530e+00 -5.04716709e-02  6.52902699e+00 -1.28226146e-01\n",
      "  -9.77456284e+00  3.92730236e-02  1.62782315e-02  4.18492109e-02\n",
      "  -1.21385789e+00 -7.03731030e-02 -2.84429398e+01 -2.00551128e+00\n",
      "  -3.20689917e+00 -6.64587212e+00  2.54440513e-02 -3.68518686e+00\n",
      "  -5.22666216e+00 -2.94626122e+01 -1.07276715e-01 -1.23526491e-01\n",
      "  -2.89777899e+00 -2.52961874e+00  3.57414447e-02 -2.20955396e+00\n",
      "  -4.56054115e+00  1.02863861e-02 -1.47098109e-01 -5.16790295e+00\n",
      "  -2.23341092e-01 -8.38351697e-02  4.70025539e-02 -1.41229466e-01\n",
      "  -8.98615047e-02 -2.13244289e-01  4.36512567e-02 -4.03446369e-02]\n",
      " [ 3.62962671e-02  1.83254070e+01  6.22434568e+00  6.79018646e-02\n",
      "  -1.48962154e+01 -6.00655042e-02 -1.06064689e+00  9.04380989e+00\n",
      "   2.91765881e+00 -8.11569765e-02  7.17019424e+01  1.86425805e+00\n",
      "   6.00110149e+00  8.60854912e+00  1.55076969e+00 -4.27316166e-02\n",
      "   1.30674181e+01  1.03043893e-03  2.96831764e-02  1.43853918e-01\n",
      "   6.33324575e+00 -6.83948919e-02  2.94788834e-02  2.30601002e-02\n",
      "   2.45575380e+00  5.35468124e-02 -4.59441654e-02  2.55337656e-02\n",
      "   2.00937366e+01 -3.95007022e-02 -1.28263637e-01 -8.46110582e-02\n",
      "  -1.15862682e-01 -1.28481343e-01  7.89874867e-02 -9.28345993e-02\n",
      "   1.13644361e-01 -1.35146724e-02  4.48991776e+00 -1.13675259e-01\n",
      "   4.24832515e-02  1.03324622e-01  1.73929596e+01  4.25728750e+00\n",
      "   1.26962194e+01  4.38965149e-02 -2.31372476e-01  7.09635485e-03\n",
      "   1.08039637e+01 -6.73900172e-02  2.85397363e+00  4.44792882e-02\n",
      "  -6.76943827e-03  2.75407195e+00 -1.32775409e-02  1.89675694e+01\n",
      "   4.29320717e+01  1.96194077e+01 -8.21219310e-02  1.33750616e-02\n",
      "   3.45903374e-02 -4.07795124e-02  4.09781486e-02  1.46487932e+01\n",
      "   7.28114414e+00  7.95230120e-02  8.11614609e+00 -3.08042299e-02\n",
      "   1.63460579e+01 -1.61419846e-02 -2.26372167e-01 -4.03693952e-02\n",
      "   2.28633356e+00 -1.78061783e-01  3.97243576e+01  3.78829741e+00\n",
      "   5.98794556e+00  1.09838743e+01 -2.80534532e-02  6.77917099e+00\n",
      "   8.62077141e+00  4.56426888e+01 -1.36527985e-01  1.31385997e-01\n",
      "   5.55602503e+00  4.96369314e+00  6.13359036e-03  4.07540846e+00\n",
      "   8.46702766e+00 -3.19960974e-02  2.91927278e-01  8.49272156e+00\n",
      "  -1.12344828e-02  4.91445921e-02 -1.63539778e-02  4.14223932e-02\n",
      "   1.10225916e-01 -7.55767375e-02  1.71926469e-02 -8.31570327e-02]]\n",
      "<NDArray 4x100 @cpu(0)>, \n",
      "[ 0.0000000e+00 -1.4130005e+00 -4.7619188e-01  0.0000000e+00\n",
      " -2.5990713e-01  0.0000000e+00 -2.9822554e-02  7.9863065e-01\n",
      " -2.1693563e-01  0.0000000e+00 -5.6070714e+00 -1.4694294e-01\n",
      " -4.4574896e-01 -6.5645552e-01 -1.1710218e-01  0.0000000e+00\n",
      "  1.4659293e+00  0.0000000e+00  0.0000000e+00  0.0000000e+00\n",
      " -5.2005625e-01  0.0000000e+00  0.0000000e+00  0.0000000e+00\n",
      " -1.8987605e-01  0.0000000e+00  0.0000000e+00  0.0000000e+00\n",
      " -1.9701183e+00  0.0000000e+00  0.0000000e+00  0.0000000e+00\n",
      "  0.0000000e+00  0.0000000e+00  0.0000000e+00 -6.2266397e-03\n",
      "  0.0000000e+00  0.0000000e+00 -3.5192010e-01  0.0000000e+00\n",
      "  0.0000000e+00 -8.7306346e-04  2.0440741e+00 -3.8012901e-01\n",
      " -1.0575018e+00  0.0000000e+00  0.0000000e+00  0.0000000e+00\n",
      "  4.3751591e-01  0.0000000e+00 -2.2446975e-01  0.0000000e+00\n",
      "  0.0000000e+00  2.9935694e-01  0.0000000e+00  1.7387906e+00\n",
      " -4.2011690e+00  2.2205310e+00 -5.7627405e-03  0.0000000e+00\n",
      " -4.8048529e-04  0.0000000e+00  0.0000000e+00 -1.2205672e+00\n",
      " -6.0722911e-01  0.0000000e+00  8.8719958e-01 -7.0284549e-03\n",
      " -1.3414543e+00 -3.7664734e-03  0.0000000e+00  0.0000000e+00\n",
      " -1.6674715e-01  0.0000000e+00 -3.8716335e+00 -2.8122270e-01\n",
      " -4.5870456e-01 -9.2774719e-01  0.0000000e+00 -5.1434278e-01\n",
      " -7.2126234e-01 -4.0052490e+00  0.0000000e+00  0.0000000e+00\n",
      " -4.1335917e-01 -3.7208891e-01  0.0000000e+00 -3.0479911e-01\n",
      " -6.4522362e-01  0.0000000e+00 -2.6256714e-03 -7.1061242e-01\n",
      "  0.0000000e+00  0.0000000e+00 -5.5616545e-03 -4.1207611e-03\n",
      "  0.0000000e+00 -1.1753783e-03 -9.5903371e-03  0.0000000e+00]\n",
      "<NDArray 100 @cpu(0)>]\n"
     ]
    }
   ],
   "source": [
    "print([w,b])\n",
    "a=net(y_test)\n",
    "\n",
    "set_figsize()\n",
    "#plt.scatter(x[:, 1].asnumpy(), x_label[:, 0].asnumpy(), 1);  # 加分号只显示图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "77210598",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1202.9851   ]\n",
      " [ 888.622    ]\n",
      " [ 888.622    ]\n",
      " [ 888.622    ]\n",
      " [ 852.02594  ]\n",
      " [ 852.02594  ]\n",
      " [ 733.08875  ]\n",
      " [ 742.23773  ]\n",
      " [ 723.93976  ]\n",
      " [ 723.93976  ]\n",
      " [ 723.93976  ]\n",
      " [ 696.4927   ]\n",
      " [ 696.4927   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 811.9637   ]\n",
      " [ 811.9637   ]\n",
      " [ 811.9637   ]\n",
      " [ 811.9637   ]\n",
      " [ 811.9637   ]\n",
      " [ 830.26227  ]\n",
      " [ 830.26227  ]\n",
      " [ 830.26227  ]\n",
      " [ 821.11285  ]\n",
      " [ 821.11285  ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 866.8588   ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 921.7522   ]\n",
      " [ 903.45416  ]\n",
      " [ 903.45416  ]\n",
      " [ 903.45416  ]\n",
      " [ 903.45416  ]\n",
      " [ 903.45416  ]\n",
      " [ 903.45416  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 894.30597  ]\n",
      " [ 885.15686  ]\n",
      " [ 885.15686  ]\n",
      " [ 885.15686  ]\n",
      " [ 885.15686  ]\n",
      " [ 885.15686  ]\n",
      " [ 912.60394  ]\n",
      " [ 912.60394  ]\n",
      " [ 912.60394  ]\n",
      " [ 912.60394  ]\n",
      " [ 912.60394  ]\n",
      " [ 940.0502   ]\n",
      " [ 940.0502   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 876.0079   ]\n",
      " [ 731.3569   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 614.1519   ]\n",
      " [ 586.7042   ]\n",
      " [ 586.7042   ]\n",
      " [ 586.7042   ]\n",
      " [ 623.30115  ]\n",
      " [ 623.30115  ]\n",
      " [ 623.30115  ]\n",
      " [ 623.30115  ]\n",
      " [ 659.89746  ]\n",
      " [ 659.89746  ]\n",
      " [ 659.89746  ]\n",
      " [ 696.4927   ]\n",
      " [ 696.4927   ]\n",
      " [ 696.4927   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 714.7907   ]\n",
      " [ 714.7907   ]\n",
      " [ 733.08875  ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 733.08875  ]\n",
      " [ 733.08875  ]\n",
      " [ 751.38684  ]\n",
      " [ 751.38684  ]\n",
      " [ 696.4927   ]\n",
      " [ 696.4927   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 669.04565  ]\n",
      " [ 669.04565  ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 678.1955   ]\n",
      " [ 678.1955   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 687.3436   ]\n",
      " [ 659.89746  ]\n",
      " [ 659.89746  ]\n",
      " [ 659.89746  ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 705.6417   ]\n",
      " [ 659.89746  ]\n",
      " [ 659.89746  ]\n",
      " [ 669.04565  ]\n",
      " [ 669.04565  ]\n",
      " [ 669.04565  ]\n",
      " [ 669.04565  ]\n",
      " [ 669.04565  ]\n",
      " [ 669.04565  ]\n",
      " [ 797.13184  ]\n",
      " [ 797.13184  ]\n",
      " [ 797.13184  ]\n",
      " [ 815.4298   ]\n",
      " [ 815.4298   ]\n",
      " [ 842.87695  ]\n",
      " [ 842.87695  ]\n",
      " [ 852.02594  ]\n",
      " [ 852.02594  ]\n",
      " [ 852.02594  ]\n",
      " [ 852.02594  ]\n",
      " [ 861.17487  ]\n",
      " [ 861.17487  ]\n",
      " [ 861.17487  ]\n",
      " [ 888.622    ]\n",
      " [ 888.622    ]\n",
      " [ 870.324    ]\n",
      " [ 870.324    ]\n",
      " [ 824.579    ]\n",
      " [ 824.579    ]\n",
      " [ 824.579    ]\n",
      " [ 765.97687  ]\n",
      " [ 765.97687  ]\n",
      " [ 765.97687  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 729.381    ]\n",
      " [ 711.0829   ]\n",
      " [ 711.0829   ]\n",
      " [ 711.0829   ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 692.78485  ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 747.6789   ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 738.52997  ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 647.0398   ]\n",
      " [ 610.4437   ]\n",
      " [ 610.4437   ]\n",
      " [ 610.4437   ]\n",
      " [ 610.4437   ]\n",
      " [ 610.4437   ]\n",
      " [ 610.4437   ]\n",
      " [ 361.44476  ]\n",
      " [ 361.44476  ]\n",
      " [ 361.44476  ]\n",
      " [ 361.44476  ]\n",
      " [ 361.44476  ]\n",
      " [ 361.44476  ]\n",
      " [ 487.79797  ]\n",
      " [ 487.79797  ]\n",
      " [ 487.79797  ]\n",
      " [ 496.9472   ]\n",
      " [ 524.3947   ]\n",
      " [ 506.0965   ]\n",
      " [ 506.0965   ]\n",
      " [ 487.79797  ]\n",
      " [ 487.79797  ]\n",
      " [ 487.79797  ]\n",
      " [ 496.9472   ]\n",
      " [ 496.9472   ]\n",
      " [ 496.9472   ]\n",
      " [ 496.9472   ]\n",
      " [ 460.35022  ]\n",
      " [ 460.35022  ]\n",
      " [ 460.35022  ]\n",
      " [ 460.35022  ]\n",
      " [ 460.35022  ]\n",
      " [ 460.35022  ]\n",
      " [ 460.35022  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 469.49945  ]\n",
      " [ 225.94147  ]\n",
      " [ 225.94147  ]\n",
      " [ 271.68768  ]\n",
      " [ 271.68768  ]\n",
      " [ 271.68768  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 293.69275  ]\n",
      " [ 293.69275  ]\n",
      " [ 293.69275  ]\n",
      " [ 302.84195  ]\n",
      " [ 302.84195  ]\n",
      " [ 235.09073  ]\n",
      " [ 235.09073  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 244.23999  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 263.18027  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 253.38919  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 353.38638  ]\n",
      " [ 362.53537  ]\n",
      " [ 362.53537  ]\n",
      " [ 362.53537  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 335.08832  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [   4.6784344]\n",
      " [   4.6784344]\n",
      " [   4.6784344]\n",
      " [   4.6784344]\n",
      " [   4.6784344]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 217.88362  ]\n",
      " [ 214.17581  ]\n",
      " [ 214.17581  ]\n",
      " [ 195.8778   ]\n",
      " [ 195.8778   ]\n",
      " [ 245.33072  ]\n",
      " [ 214.17581  ]\n",
      " [ 214.17581  ]\n",
      " [ 214.17581  ]\n",
      " [ 214.17581  ]\n",
      " [ 214.17581  ]\n",
      " [ 159.28172  ]\n",
      " [ 159.28172  ]\n",
      " [ 159.28172  ]\n",
      " [ 140.98367  ]\n",
      " [ 406.3043   ]\n",
      " [ 406.3043   ]\n",
      " [ 241.62288  ]\n",
      " [ 241.62288  ]\n",
      " [ 241.62288  ]\n",
      " [ 177.57979  ]\n",
      " [ 177.57979  ]\n",
      " [ 168.43071  ]\n",
      " [ 168.43071  ]\n",
      " [ 132.47778  ]\n",
      " [ 131.8355   ]\n",
      " [ 131.8355   ]\n",
      " [ 131.8355   ]\n",
      " [ 140.98367  ]\n",
      " [ 140.98367  ]\n",
      " [ 140.98367  ]\n",
      " [ 131.8355   ]\n",
      " [ 131.8355   ]\n",
      " [ 131.8355   ]\n",
      " [   7.000754 ]\n",
      " [ 120.71044  ]\n",
      " [ 179.31232  ]\n",
      " [ 179.31232  ]\n",
      " [ 179.31232  ]\n",
      " [ 197.61038  ]\n",
      " [ 179.31232  ]\n",
      " [ 327.67188  ]\n",
      " [   6.9996414]\n",
      " [   6.9996414]\n",
      " [ 136.18443  ]\n",
      " [ 136.18443  ]\n",
      " [ 137.87117  ]\n",
      " [ 137.87117  ]\n",
      " [ 176.12975  ]\n",
      " [ 176.12975  ]\n",
      " [ 166.97151  ]\n",
      " [ 166.97151  ]\n",
      " [ 296.13712  ]\n",
      " [ 296.13712  ]\n",
      " [ -21.701994 ]\n",
      " [  88.27859  ]\n",
      " [ -20.375107 ]\n",
      " [ -19.04822  ]\n",
      " [ -29.663774 ]\n",
      " [ -29.663774 ]\n",
      " [ -20.375107 ]\n",
      " [ -20.375107 ]\n",
      " [ -29.663774 ]\n",
      " [ -29.663774 ]\n",
      " [ -29.663774 ]\n",
      " [ -29.663774 ]\n",
      " [ -29.663774 ]\n",
      " [ -29.663774 ]\n",
      " [ -27.009825 ]\n",
      " [ -27.009825 ]\n",
      " [ -20.375107 ]\n",
      " [ -20.375107 ]\n",
      " [  -2.5680547]\n",
      " [  -2.5680547]\n",
      " [ -19.04822  ]\n",
      " [ -19.04822  ]\n",
      " [ -21.701994 ]\n",
      " [ -21.701994 ]\n",
      " [ -26.329699 ]\n",
      " [ -26.329699 ]\n",
      " [  58.01453  ]\n",
      " [  58.01453  ]\n",
      " [ -26.329699 ]\n",
      " [ -26.329699 ]\n",
      " [  58.01453  ]\n",
      " [  58.01453  ]\n",
      " [  58.01453  ]\n",
      " [  58.01453  ]\n",
      " [  78.23508  ]\n",
      " [  78.23508  ]\n",
      " [  47.918213 ]\n",
      " [  47.918213 ]\n",
      " [ 128.69418  ]\n",
      " [ 310.88763  ]\n",
      " [ 310.88763  ]\n",
      " [ 310.88763  ]\n",
      " [ 310.88763  ]\n",
      " [ 310.88763  ]\n",
      " [ 310.88763  ]\n",
      " [ 310.88763  ]\n",
      " [  58.01453  ]\n",
      " [  58.01453  ]\n",
      " [  58.01453  ]\n",
      " [  88.30578  ]\n",
      " [  88.30578  ]\n",
      " [  88.30578  ]\n",
      " [  47.918213 ]\n",
      " [  47.918213 ]\n",
      " [ 138.79126  ]\n",
      " [ 138.79126  ]\n",
      " [ 138.79126  ]\n",
      " [ 138.79126  ]\n",
      " [ 108.499985 ]\n",
      " [ 108.499985 ]\n",
      " [ -12.664358 ]\n",
      " [ -12.664358 ]\n",
      " [  47.944603 ]\n",
      " [  47.944603 ]\n",
      " [  37.846706 ]\n",
      " [  37.846706 ]\n",
      " [  47.944603 ]\n",
      " [  47.944603 ]\n",
      " [  17.653301 ]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "a1=a.asnumpy()\n",
    "print(a1)\n",
    "np.savetxt(\"./result.txt\",a1,fmt='%d')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "c52cd1fa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[58.297997]\n",
      " [72.16091 ]\n",
      " [72.16091 ]\n",
      " ...\n",
      " [47.944603]\n",
      " [47.944603]\n",
      " [17.653301]]\n"
     ]
    }
   ],
   "source": [
    "newx=nd.concat(x,y_test,dim=0)\n",
    "newx_label=net(newx)\n",
    "\n",
    "a11=newx_label.asnumpy()\n",
    "print(a11)\n",
    "np.savetxt(\"./result.txt\",a11,fmt='%d')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:gluon] *",
   "language": "python",
   "name": "conda-env-gluon-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
